package huginTools;

import COM.hugin.HAPI.*;

/** Provides a set of static methods to access methods
 * in the Hugin Java API that have different definitions in
 * the 32 and 64 bit versions of Hugin. 
 * 
 * When compiling application code on a xx bit platform, uncomment 
 * the xx bit part of this class. 
 * 
 * 
 * 
 * @author jaeger
 *
 */
public class Hugin32_64Converter {
	
	/***************************************
	 * 	                                   *
	 *   32 Bit version                    *
	 *                                     * 
	 ***************************************/

// 	public static int getIndex(Table cpt, int[] localvals)
// 	throws ExceptionHugin
// 	{
// 		return cpt.getIndex(localvals);
// 	}

// 	public static int getSize(Table cpt)
// 	throws ExceptionHugin
// 	{
// 		return cpt.getSize();
// 	}

// 	public static int getNumberOfStates(DiscreteChanceNode dcn)
// 	throws ExceptionHugin
// 	{
// 		return dcn.getNumberOfStates();
// 	}
	
// 	public static void setNumberOfCases(Domain bnet, int samplesize)
// 	throws ExceptionHugin
// 	{
// 		bnet.setNumberOfCases(samplesize);
// 	}

// 	public static void setMaxNumberOfEMIterations(Domain bnet, int emits)
// 	throws ExceptionHugin
// 	{
// 		bnet.setMaxNumberOfEMIterations(emits);
// 	}
	
	
	/***************************************
	 * 	                                   *
	 *   64 Bit version                    *
	 *                                     * 
	 ***************************************/
	
	public static int getIndex(Table cpt, int[] localvals)
	throws ExceptionHugin
	{
		long[] longlocalvals = new long[localvals.length];
		for (int i=0;i<localvals.length;i++)
			longlocalvals[i]=(long)localvals[i];
		return (int)cpt.getIndex(longlocalvals);
	}

	public static int getSize(Table cpt)
	throws ExceptionHugin
	{
		return (int)cpt.getSize();
	}

	public static int getNumberOfStates(DiscreteChanceNode dcn)
	throws ExceptionHugin
	{
		return (int)dcn.getNumberOfStates();
	}

	public static void setNumberOfCases(Domain bnet, int samplesize)
	throws ExceptionHugin
	{
		bnet.setNumberOfCases((long)samplesize);
	}

	public static void setMaxNumberOfEMIterations(Domain bnet, int emits)
	throws ExceptionHugin
	{
		bnet.setMaxNumberOfEMIterations((long)emits);
	}
	
	
}
